<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="con" style="border:5px solid red;width:400px; height:400px;padding:20px">
        <img src="./images/fruit4.png" style="width:100%" />
    </div>
</body>
<script>
    var con = document.getElementById("con");
    con.onmouseover = function(){
        this.style.border = "1px solid blue";
    }
    //鼠标键点击时，触发事件onmousedown
    con.onmousedown = function(){
        this.style.backgroundColor = "pink";
    }
    //鼠标键松开时，触发事件onmouseup
    con.onmouseup = function(){
        this.style.backgroundColor = "white";
    }
    con.onclick = function(){
        console.log(this.style.height,this.style.width);
    }
</script>
</html>